package com.itheima.tlias84.mapper;


import com.itheima.tlias84.dto.SelectAllEmpDTO;
import com.itheima.tlias84.dto.SelectEmpDTO;
import com.itheima.tlias84.dto.SelectEmpDetailDTO;
import com.itheima.tlias84.entity.Emp;
import com.itheima.tlias84.po.InsertEmpParam;
import com.itheima.tlias84.po.SelectEmpPageParam;
import com.itheima.tlias84.po.UpdateEmpParam;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * 都是dao层的注解
 * @Mapper ->mybaties提供
 * @Repository->由spring提供
 */
//@Repository
@Mapper
public interface EmpMapper {
    List<SelectEmpDTO> selectEmpByPage(@Param("p")SelectEmpPageParam param);

//    int insertOne(@Param("e")Emp emp);

    int batchDelete(@Param("ids") List<Integer> ids);

    int insertEmp(@Param("p") InsertEmpParam param);

    int updateEmp(@Param("p") UpdateEmpParam param);

    SelectEmpDetailDTO selectEmpById(@Param("id") Integer id);

    List<SelectAllEmpDTO> selectAllEmp();

    @Select("select id,username,password,name from emp where username = #{username}")
    Emp selectEmpByUserName(@Param("username")String userName);
}
